﻿@model KhuyenMaiVang.Models.ResBusiness
@{
    ViewBag.Title = "RegisterBusiness";
    Layout = "~/Views/Shared/_LayoutDetail.cshtml";
}
<div id="container-normal" class="box-item">
<h2>Đăng kí thành viên</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(false)
    <fieldset>
        <legend>Thông tin người dùng</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.Username)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgUser.Username)
            @Html.ValidationMessageFor(model => model.OrgUser.Username)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.Password)
        </div>
        <div class="editor-field">
            @Html.PasswordFor(model => model.OrgUser.Password)
            @Html.ValidationMessageFor(model => model.OrgUser.Password)
        </div>
    
        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.PasswordConfirm)
        </div>
        <div class="editor-field">
            @Html.PasswordFor(model => model.OrgUser.PasswordConfirm)
            @Html.ValidationMessageFor(model => model.OrgUser.PasswordConfirm)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgUser.Email)
            @Html.ValidationMessageFor(model => model.OrgUser.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.DisplayName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgUser.DisplayName)
            @Html.ValidationMessageFor(model => model.OrgUser.DisplayName)
        </div>
    
        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.Avatar)
        </div>
        <div class="editor-field">
            @Html.HiddenFor(model => model.OrgUser.Avatar)
        </div>
        <!-- Ajax upload avatar -->
        <script src="@Url.Content("~/Content/scripts/ajaxupload/fileuploader.js")" type="text/javascript"></script>
        <link href="@Url.Content("~/Content/scripts/ajaxupload/fileuploader.css")" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
            function createUploader() {
                var uploader = new qq.FileUploader({
                    element: document.getElementById('file-uploader'),
                    action: '/Admin/Helper/Upload/',
                    debug: true,
                    multiple: false,
                    allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
                    onComplete: function (file, response) {
                        var fullName = "/content/kmvdata/avatars/" + response;
                        $('#previewAvatar').attr('src', fullName);
                        $('#previewAvatar').height(100);
                        $('input[id=OrgUser_Avatar]').val(fullName);
                    }
                });
            }
            window.onload = createUploader;     
        </script>
        <div id="file-uploader">
            
        </div>
        <img alt="" id="previewAvatar" src="" height=""/>
        <div class="editor-label">
            @Html.LabelFor(model => model.OrgUser.Phone)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgUser.Phone)
            @Html.ValidationMessageFor(model => model.OrgUser.Phone)
        </div>
    </fieldset>
    <fieldset>
        <legend>Thông tin doanh nghiệp</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.OrgBusiness.TaxeNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgBusiness.TaxeNumber)
            @Html.ValidationMessageFor(model => model.OrgBusiness.TaxeNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrgBusiness.MangerName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgBusiness.MangerName)
            @Html.ValidationMessageFor(model => model.OrgBusiness.MangerName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrgBusiness.Website)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrgBusiness.Website)
            @Html.ValidationMessageFor(model => model.OrgBusiness.Website)
        </div>
    </fieldset>
        <p>
            <input class="button" type="submit" value="Đăng kí" />
        </p>
}
</div>